package com.efuture.filter;


import jakarta.servlet.*;

import java.io.IOException;

/**
 * @description: Filter注解使用
 * @author zhaoshanshan
 * @date 2021/10/4 8:55 下午
 * @version 1.0
 */
//@WebFilter(value = "/*",dispatcherTypes = {DispatcherType.REQUEST,DispatcherType.FORWARD})//访问 转发 index.jsp都进行拦截
public class FilterAnnotationTest implements Filter {

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        Filter.super.init(filterConfig);
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("FiterAnnotationTest...被执行了");
        filterChain.doFilter(servletRequest,servletResponse);
        System.out.println("FiterAnnotationTest...执行完成了");
    }

    @Override
    public void destroy() {
        Filter.super.destroy();

    }
}
